

import { defineStore } from 'pinia';

export const useFileStore = defineStore('File', {
    state: () => ({
        //文件对象 key为filed value:文件对象   result: 返回文件结果, fileUrl: 文件地址blob, fileId:文件id,
        fileItem: {},
    }),
    actions: {
        /** 获取文件*/
        getFileItem(fileId) {
            return fileId ? this.fileItem[fileId] : null
        },
        /**
         * 
         * @param {*} f存储文件
         */
        setFileItem(fileObject) {
            this.fileItem[fileObject.fileId] = fileObject
        },
    },
});
